﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Security;
using System.Text;
using System.Threading.Tasks;
using Common.Security;
using NUnit.Framework;

namespace Common.Tests.Security
{
    [TestFixture]
    public class ByteArrayExtensionTests
    {
        private const string testString = "testData1234%7";

        [Test]
        public void EncryptDecryptTestString()
        {
            var secureString = new SecureString();
            secureString.Append(testString);

            var asEncodedByteArray = ByteArrayExtension.AsEncryptedByteArray(secureString);

            var asDecodedSecureString = ByteArrayExtension.AsDecryptedSecureString(asEncodedByteArray);
            var result = asDecodedSecureString.Decode();

            Assert.AreEqual(testString, result);
        }

    }
}
